﻿package mortal.game.scene3D.fight
{
    import extend.language.*;
    import mortal.game.scene3D.display3d.text3d.staticText3d.*;

    public class FightUpdateAttribtue extends Object
    {
        public var hurtNumber:int = 0;
        public var suckNumber:int = 0;
        public var manaNumber:int = 0;
        public var hurtType:int = 0;
        public var reflexNumber:int = 0;
        public var reboundNumber:int = 0;
        public var cureNumber:int = 0;
        public var isAnti:Boolean = false;
        public var isJouk:Boolean = false;
        public var isImmune:Boolean = false;
        public var isCrit:Boolean = false;
        public var isCrush:Boolean = false;
        public var isBlock:Boolean = false;
        public var isAdd:Boolean = false;
        public var textDirection:int;
        public var fromX:Number = 0;
        public var fromY:Number = 0;
        public var toX:Number = 0;
        public var toY:Number = 0;
        public var toX3D:Number = 0;
        public var toY3D:Number = 0;
        public var toZ3D:Number = 0;
        public var isPet:Boolean = false;
        public var randomValue:Number = -1;
        private static const MAX_RATIO:Number = 2.32831e-010;

        public function FightUpdateAttribtue()
        {
            return;
        }// end function

        public function get isPetType() : Boolean
        {
            return this.isPet && this.getColor() == ENumberTextColor.yellowAndRed && !this.isCrit && !this.isJouk && !this.isImmune && !this.isCrush && !this.isBlock && this.suckNumber <= 0 && this.reflexNumber <= 0 && this.reboundNumber <= 0;
        }// end function

        public function get isScale() : Boolean
        {
            return this.isCrit || this.isCrush && this.reflexNumber == 0 && this.reboundNumber == 0 && this.cureNumber == 0;
        }// end function

        public function getColor() : Number
        {
            if (this.manaNumber < 0)
            {
                return ENumberTextColor.blue0;
            }
            if (this.manaNumber > 0)
            {
                return ENumberTextColor.blue0;
            }
            if (this.hurtNumber < 0)
            {
                return ENumberTextColor.green0;
            }
            if (this.hurtNumber > 0)
            {
                return ENumberTextColor.yellowAndRed;
            }
            if (this.isAdd)
            {
                if (this.hurtType == 1)
                {
                    return ENumberTextColor.blue0;
                }
                return ENumberTextColor.green0;
            }
            else
            {
            }
            return ENumberTextColor.yellowAndRed;
        }// end function

        public function getText() : String
        {
            var _loc_1:String = null;
            if (this.isAnti)
            {
                return Language.getString(20655);
            }
            if (this.isJouk)
            {
                return Language.getString(20656);
            }
            if (this.isImmune)
            {
                return Language.getString(20657);
            }
            _loc_1 = "";
            if (this.isCrit)
            {
                _loc_1 = _loc_1 + Language.getString(20658);
            }
            else if (this.isCrush)
            {
                _loc_1 = _loc_1 + Language.getString(20659);
            }
            else if (this.isBlock)
            {
                _loc_1 = _loc_1 + Language.getString(20660);
            }
            if (this.manaNumber < 0)
            {
                _loc_1 = _loc_1 + ("+" + Math.abs(this.manaNumber));
            }
            else if (this.manaNumber > 0)
            {
                _loc_1 = _loc_1 + ("-" + this.manaNumber);
            }
            else if (this.hurtNumber < 0)
            {
                _loc_1 = _loc_1 + ("+" + Math.abs(this.hurtNumber));
            }
            else if (this.hurtNumber > 0)
            {
                _loc_1 = _loc_1 + ("-" + this.hurtNumber);
            }
            else if (this.isAdd)
            {
                _loc_1 = _loc_1 + ("+" + this.hurtNumber);
            }
            else
            {
                _loc_1 = _loc_1 + ("-" + this.hurtNumber);
            }
            if (this.cureNumber > 0)
            {
                _loc_1 = _loc_1 + ("(+" + this.cureNumber + ")");
            }
            if (this.suckNumber > 0)
            {
                _loc_1 = _loc_1 + Language.getStringByParam(20661, this.suckNumber);
            }
            if (this.reflexNumber > 0)
            {
                _loc_1 = _loc_1 + Language.getStringByParam(20662, this.reflexNumber);
            }
            if (this.reboundNumber > 0)
            {
                _loc_1 = _loc_1 + Language.getStringByParam(20663, this.reboundNumber);
            }
            return _loc_1;
        }// end function

        public function random(param1:uint) : void
        {
            this.randomValue = (25173 * param1 + 13849) % 65536 / 65536;
            return;
        }// end function

    }
}
